function initRoles() {
    $.ajax({
        type: 'get',
        url: '/roles/all',
        async: false,
        success: function (data) {
            var r = $("#roles");
            for (var i = 0; i < data.length; i++) {
                var d = data[i];
                var id = d['id'];
                var name = d['name'];
                var description = d['description'];
                var t = "<input lay-filter='switchTest' lay-skin='primary' type='radio' title='" + description + "' id='" + name + "' value='" + id + "'name='radio'>";
                r.append(t);
            }
        }
    });
}

function getCheckedRoleIds() {
    var ids = [];
    $("#roles input[type='radio']").each(function () {
        if ($(this).prop("checked")) {
            ids.push($(this).val());
        }
    });
    return ids;
}